<?php  
/**
* 
*/
class Utility_Model extends CI_Model
{
	
	function __construct()
	{
		parent::__construct();
		
	}

	public function changeToUTF8($data){
		
		if (is_array($data)) {

			foreach ($data as $key => $value) {

				if (is_array($data[$key])) {
					$data[$key] = $this->changeToUTF8($data[$key]);
				}else{
					if ($key == "BIRTH_DATE")
						$data[$key] = date('Y-m-d', strtotime($value));
					else if($key == "COMMAND_DATE")
						$data[$key] = date('d/m/Y', strtotime($value));
					else			
						$data[$key] = iconv("TIS-620","UTF-8",$value);	
				}
			}
		}	
		else
		{
			$data = iconv("TIS-620","UTF-8",$value);
		}
		return $data;
	}

	public function changeFormatDate($d){
		list($day , $month , $year) = explode('-', $d);
		return "".$year.$month.$day;
	}
}
?>